<#assign ctx = request.contextPath />
<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" />
    <title>消息</title>
    <link href="${ctx}/assets/css/bootstrap.min.css" rel="stylesheet">
    <link href="${ctx}/assets/css/weixing.css" rel="stylesheet"/>
    <style>
    	.nav-box{
	   		padding-left: 15px;
	   		padding-right: 15px;
    	}
    		
    	.nav-top{
    		max-width:50%;
    		max-height:100%;
    		border-style: solid;
    		border-color: #06b9d9;
    		border-width:1px ;
    		font-size: 20px;
    		color:#06b9d9;
    		text-align: center;
    		padding-top: 18px;
    		margin-left:auto;
			margin-right:auto;
			margin-top: 20px;
    	}
    	.nav-link{
    		width: 100%;
    		height: 140px;
    		text-align: center;
    		margin:20px 0px;
    		background-size: 100% 100%;
    		font-size: 26px;
    		padding-top: 20px;
    		color: #FFFFFF;
    	}
    	.nav-link img {
    		max-width:100%;
    		max-height:100%;
    	}
    </style>
  </head>
  <body>
	<div class="nav-box">
	  	<div class="nav-top">
	  		<p></p>
	  	</div>
  	</div>  	
    <script src="${ctx}/assets/js/jquery-1.11.0.min.js"></script>
    <script src="${ctx}/assets/js/bootstrap.min.js"></script>
    <script src="${ctx}/assets/js/wxcommon.js"></script>
    <script type="text/javascript">
    	window.daijia = {ctx:'${ctx}'};
		$(document).ready(function(){
			if(em.is_weixin()){
				var base_url="https://open.weixin.qq.com/connect/oauth2/authorize?appid=${setting.wxAppId?if_exists}&redirect_uri="+URLEncode('${ctx}/${redirectUrl}')+"&response_type=code&scope=snsapi_base&state=null#wechat_redirect";
				
				var _obj = em.UrlGet();
			alert(_obj);
				if(_obj.code){
					$.post('${ctx}/wx/v1/userInfo',{'code':_obj.code},function(data){
						var openId = data.object.openId;
						if(openId){
							window.location.replace("${ctx}/${redirectUrl}?wxuser="+openId);
						}
						else{
							alert("未能获取到openId，请稍后再试");
						}
					},'json');
				}
				else{
					window.location.replace(base_url);
					//alert("未能获取到code，请稍后再试");
				}
			}
			else{
				alert("请在微信中打开")
			}
		})	
	</script>
  </body>
</html>